package com.xbongbong.saas.service;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.pojo.FieldAttrEntityForImport;
import com.xbongbong.paas.pojo.dto.FormDataAddDTO;
import com.xbongbong.paas.pojo.dto.ImportFormDataDTO;
import com.xbongbong.paas.pojo.dto.SaasFormSaveDTO;
import com.xbongbong.paas.pojo.dto.ValidateDataDTO;
import com.xbongbong.paas.pojo.imports.CellTitlePojo;
import com.xbongbong.paas.pojo.imports.RowGroupPojo;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.formdata.pojo.AfterSavePojo;
import com.xbongbong.pro.formdata.pojo.dto.SaasAnalysisDataDTO;
import com.xbongbong.pro.formexplain.pojo.dto.HandlerExplainInLinkItemDTO;
import com.xbongbong.pro.listbatch.pojo.dto.AddLabelDTO;
import com.xbongbong.pro.suppliercontact.pojo.dto.SupplierContactDeleteBatchDTO;
import com.xbongbong.pro.suppliercontact.pojo.dto.SupplierContactEditAttrUpdateDTO;
import com.xbongbong.pro.suppliercontact.pojo.dto.SupplierContactUpdateByBusinessRuleDTO;
import com.xbongbong.pro.suppliercontact.pojo.vo.SupplierContactDeleteBatchVO;
import com.xbongbong.pro.suppliercontact.pojo.vo.SupplierContactEditAttrUpdateVO;

import java.util.List;

/**
 * 供应商联系人service接口层
 * @author Jian.Wang
 * @date 2019/1/23 20:27
 * @since v1.0
 * @version v1.0
 */
public interface SupplierContactService {

    /**
     * 供应商联系人保存前saas特殊校验
     *
     * @param validateDataDTO saas特殊校验数据入参
     * @author Jian.Wang
     * @date 2019/1/23 20:00
     * @since v1.0
     **/
    void beforeSave(ValidateDataDTO validateDataDTO) throws XbbException;

    /**
     * 供应商联系人保存后逻辑
     *
     * @param saasFormSaveDTO saas保存数据
     * @author Jian.Wang
     * @date 2019/1/23 20:00
     * @since v1.0
     **/
    AfterSavePojo afterSave(SaasFormSaveDTO saasFormSaveDTO) throws XbbException;

    /**
     * 批量删除
     * @author 吴峰
     * @date 2019/3/7 16:45
     * @param supplierContactDeleteBatchDTO
     * @return com.xbongbong.pro.suppliercontact.pojo.vo.SupplierContactDeleteBatchVO
     * @throws XbbException 业务异常
     */
    SupplierContactDeleteBatchVO deleteBatch(SupplierContactDeleteBatchDTO supplierContactDeleteBatchDTO) throws XbbException;

    /**
     * 批量编辑
     * @author 吴峰
     * @date 2019/3/7 16:45
     * @param supplierContactEditAttrUpdateDTO
     * @return com.xbongbong.pro.suppliercontact.pojo.vo.SupplierContactEditAttrUpdateVO
     * @throws XbbException 业务异常
     */
    SupplierContactEditAttrUpdateVO batchEditAttr(SupplierContactEditAttrUpdateDTO supplierContactEditAttrUpdateDTO) throws XbbException;

    /**
     * 新建时格式化解释
     *
     * @param handlerExplainInLinkItemDTO 入参
     * @throws XbbException 异常
     */
    void formatLinkAddExplain(HandlerExplainInLinkItemDTO handlerExplainInLinkItemDTO) throws XbbException;

    /**
     * 将Excel数据格式化成表单保存需要的JSON格式的数据
     *
     * @param importFormDataDTO 导入入参
     * @param titlePojoList     标题
     * @param rowGroupPojo      一个表单对应的一组Excel填写的数据
     * @param fieldAttrList     解释
     * @return FormDataAddDTO
     * @throws XbbException XbbException
     * @author lee
     * @date 2019/4/29 14:16
     * @since V1.0
     */
    FormDataAddDTO formatExcelValue(ImportFormDataDTO importFormDataDTO, List<CellTitlePojo> titlePojoList, RowGroupPojo rowGroupPojo, List<FieldAttrEntityForImport> fieldAttrList) throws XbbException;

    /**
     * 详情页解释
     *
     * @param saasAnalysisDataDTO
     * @param result
     * @throws XbbException
     */
    void getFormatData(SaasAnalysisDataDTO saasAnalysisDataDTO, JSONObject result) throws XbbException;
    /**
     * 修改供应商名称
     * @author 吴峰
     * @date 2019/6/20 10:54
     * @param corpid 公司id
     * @param dataId 数据id
     * @param name 供应商名称
     * @return void
     * @throws XbbException 业务异常
     */
    void dataConsistencyUpdateSupplier(String corpid, Long dataId, String name) throws XbbException;

    /**
     * 根据业务规则，更新供应商联系人
     * @param supplierContactUpdateByBusinessRuleDTO
     * @throws XbbException
     */
    void updateBatchByBusinessRule(SupplierContactUpdateByBusinessRuleDTO supplierContactUpdateByBusinessRuleDTO) throws XbbException;

    /**
     * 批量增删标签字段
     * @param addLabelDTO
     * @param addBatchList
     * @throws XbbException
     */
    void updateBatchLabelAttr(AddLabelDTO addLabelDTO, List<PaasFormDataEntityExt> addBatchList, Boolean addOrDelete) throws XbbException;

    void afterSaveForWorkflow(SaasFormSaveDTO saasFormSaveDTO) throws XbbException;

    void afterSaveForUpdateWorkflow(SaasFormSaveDTO saasFormSaveDTO) throws XbbException;
}
